home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7176 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What's your compiler's answer?
  5. Date: 16 Feb 96 00:55:13 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.824432113@rscernix>
  8. References: <1996Feb7.140945.28351@cs.rit.edu> <4fq0cq$h9s@hpbblb.bbn.hp.com>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4fq0cq$h9s@hpbblb.bbn.hp.com> Matthias Dittrich <matti> writes:
  13.  
  14. >I don't know, what sense it makes to gather results of a program with
  15. >undefined behaviour (more than one inc or dec operator in one expression).
  16.  
  17. You can have as many ++ or -- operators as you like in an expression,
  18. as long as they are not applied to the same object without any intervening
  19. sequence points.  
  20.  
  21. The following examples are legal:
  22.  
  23. while (*p++ = *q++);    /* the typical implementation of strcpy */
  24. j = i++, i++, i++;     /* equivalent to: j = i + 2; i += 3; */
  25.  
  26. These are notoriously illegal:
  27.  
  28. i = i++;           /* demons fly out of your nose */
  29. printf("%d\n", i++ * ++i); /* can you hear your disk being reformatted? */
  30.  
  31. If you have any objections to any of these examples, please read the FAQ
  32. before expressing them in the newsgroup.
  33.  
  34. Dan
  35. --
  36. Dan Pop
  37. CERN, CN Division
  38. Email: danpop@mail.cern.ch 
  39. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  40.